<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>图书管理系统</title>
  <link href="${pageContext.request.contextPath}/bootstrap/css/bootstrap.css" rel="stylesheet">
  <script type="text/javascript" src="${pageContext.request.contextPath}/bootstrap/js/jQuery.js"></script>
  <script type="text/javascript">
    function checkForm() {
      var username = document.getElementById("username").value;
      var password = document.getElementById("password").value;
      if(username == null || username == ""){
        alert("用户名不能为空");
        return false;
      }
      if(password == null || password == ""){
        alert("密码不能为空");
        return false;
      }
      return true;
    }
  </script>
  <style type="text/css">
    body {
      padding-top: 200px;
      padding-bottom: 40px;
      background-image: url('images/bg.jpg');
      background-position: center;
      background-repeat: no-repeat;
      background-attachment: fixed;
    }
    .radio {
      padding-top: 10px;
      padding-bottom:10px;
    }
    .form-signin-heading{
      text-align: center;
    }
    .form-signin {
      max-width: 300px;
      padding: 19px 29px 0px;
      margin: 0 auto 20px;
      background-color: #fff;
      border: 1px solid #e5e5e5;
      -webkit-border-radius: 5px;
      -moz-border-radius: 5px;
      border-radius: 5px;
      -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
      -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
      box-shadow: 0 1px 2px rgba(0,0,0,.05);
    }
    .form-signin .form-signin-heading,
    .form-signin .checkbox {
      margin-bottom: 10px;
    }
    .form-signin input[type="text"],
    .form-signin input[type="password"] {
      font-size: 16px;
      height: auto;
      margin-bottom: 15px;
      padding: 7px 9px;
    }
  </style>
</head>
<body>
<div class="container">
  <form name="myForm" class="form-signin" action="loginServlet" method="post" onsubmit="return checkForm()">
    <h2 class="form-signin-heading"><font color="gray">图书管理系统</font></h2>
    <!-- 如果想让控件像块级元素一样占满容器，就可以为它添加 .input-block-level 类。这样，控件不仅可以占满容器，还可以根据浏览器窗口自动调整尺寸 -->
    <input id="username" name="username" type="text" class="input-block-level" placeholder="请输入用户名">
    <input id="password" name="password" type="password" class="input-block-level" placeholder="请输入密码" >
    <label class="checkbox">
      <input id="remember" name="remember" type="checkbox" value="remember-password" >记住密码 &nbsp;&nbsp;&nbsp;&nbsp;
      <font id="error" color="red">${requestScope.login_error}</font>
    </label>
    <div style="text-align: center;">
      <button class="btn btn-large btn-primary" style="margin-right: 10px" type="reset">重置</button>
      <button class="btn btn-large btn-primary" style="margin-left: 10px" type="submit">登录</button>
      <button class="btn btn-large btn-success" style="margin-left: 10px" type="button" onclick="doRegiste()">注册</button>
    </div>
    <p align="center" style="padding-top: 15px;">版权所有  xxs </p>
  </form>
</div>
</body>
<script>
  function doRegiste(event){
    // 阻止form表单提交
    // event.preventDefault();
    window.location.href="${pageContext.request.contextPath}/register.jsp";
  }
</script>
</html>
